package com.zhaoxi.demo.demo2.pros1;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author zxiaoming
 * @Description:
 * @date 2021/2/2822:17
 */
@Component(value = "pd")
public class PropertiesDemo1 {
    //@Value注解作用就是读取由spring容器装配的信息
    @Value("${user.name1}")
    private String name;
    @Value("${user.age}")
    private int age;
    @Value("${user.gender}")
    private String gender;


    public void printUserDetail(){
        System.out.println(String.format("name=%s,age=%s,gender=%s", name, age, gender));
    }
}
